#pragma once
#include "joui.h"
#include "config.h"

namespace JOUI
{
	void Jo_UIImage_Create(INT width, INT height, UIimage& dstImg);
	void Jo_UIImage_CreateFromFile(LPCWSTR file, UIimage& dstImg);
	void Jo_UIImage_CreateFromBitmap(LPVOID hBitmap, HPALETTE hPalette, HRESULT fPreAlpha, UIimage& dstImg);
	void Jo_UIImage_CreateFromIcon(HICON hIcon, UIimage& dstImg);
	void Jo_UIImage_CreateFromMemory(LPVOID data, size_t size, UIimage& dstImg);
	void Jo_UIImage_CreateFromPngbits(INT nWidth, INT nHeight, BYTE* pbBuffer, UIimage& dstImg);
	void Jo_UIImage_CreateFromBitmapWic(LPVOID src_bitmap, UIimage& dstImg);
	void Jo_UIImage_CreateFromStream(LPSTREAM lpStream, UIimage& dstImg);
	void Jo_UIImage_CreateSvg(LPCWSTR svgCode, BOOL fCode, UINT uiWidth, UINT uiHeight, INT color, UIimage& dstImg);
	void Jo_UIImage_CreateZip(UIZip* hRes, LPCWSTR fileName, UIimage& dstImg);
	HANDLE Jo_UIImage_LoadFromMemoryHandle(LPVOID lpData, size_t dwLen, INT uType = IMAGE_ICON, INT nIndex = 0);
	HRESULT Jo_UIImage_SetCurFrame(UIimage hImage, INT index);
	UINT Jo_UIImage_GetCurFrame(UIimage hImage);
	HRESULT Jo_UIImage_GetFrameCount(UIimage hImage, INT& nFrameCount);
	HRESULT Jo_UIImage_GetSize(UIimage hImage, UINT& Width, UINT& Height);
	HRESULT Jo_UIImage_NextFrame(UIimage hImage, UINT* r_next_index = nullptr, UINT* r_next_delay = nullptr);
	BOOL Jo_UIImage_GetFrameDelay(UIimage hImage, INT& lpDelayAry, INT nFrames);
	HRESULT Jo_UIImage_Lock(UIimage hImage, RECT* lpRectL, DWORD flags, INT PixelFormat, LPVOID& lpLockedBitmapData);
	HRESULT Jo_UIImage_UnLock(UIimage hImage, LPVOID lpLockedBitmapData);
	HRESULT Jo_UIImage_GetPixel(UIimage hImage, INT x, INT y, INT& r_color);
	HRESULT Jo_UIImage_SetPixel(UIimage hImage, INT x, INT y, INT color);
	HRESULT Jo_UIImage_Copy(UIimage hImage, UIimage& r_dest, RECT* copy_rect = nullptr);
	HRESULT Jo_UIImage_Scale(UIimage hImage, UINT new_width, UINT new_height,
		UIimage& r_dest, RECT* copy_rect = nullptr);
	BOOL Jo_UIImage_Rotateflip(UIimage hImage, INT rfType, UIimage& r_dest);
	LPVOID Jo_UIImage_GetContext(UIimage hImage);
	BOOL Jo_UIImage_SaveToMemory(UIimage hImage, LPVOID& lpBuffer, size_t& len, INT format = 0);
	BOOL Jo_UIImage_SaveToFile(UIimage hImage, LPCWSTR wzFileName, INT format = 0);
	HRESULT Jo_UIImage_Destroy(UIimage hImage);
}